<?php

class SettingController extends AdminController
{
	public function actionIndex()
	{
		$models = Option::model()->findAll();
		if(isset($_POST['option']))
		{
			foreach ($_POST['option'] as $key=>$val)
			{
				$option = Option::model()->findByAttributes(array("name"=>$key));
				if ($option !== NULL) {
					$option->value = $val;
					$option->update();
				}
			}
			$this->refresh();
		}
		$this->render('index', array('models'=>$models));
	}

}